package com.example.config;

import java.io.*;
import java.net.Socket;
import java.util.Scanner;

public class testClient {
    public static void main(String[] args) {
        try {
            Socket socket = new Socket("127.0.0.1", 2323);
            OutputStream outputStream = socket.getOutputStream();
            DataOutputStream dataOutputStream = new DataOutputStream(outputStream);
            Scanner scanner = new Scanner(System.in);
            if (scanner.hasNext()) {
                String str = scanner.next();
                Byte type = 0x0A;
                byte[] data = str.getBytes();
                int len = data.length + 5;
                dataOutputStream.writeByte(type);
                dataOutputStream.writeInt(len);
                dataOutputStream.write(data);
                dataOutputStream.flush();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
